{% extends "afcp/base.html" %}
{% comment %}
<!--
  Copyright (C) 2008 ZHENG Zhong <heavyzheng nospam-at gmail D0T com>
  - http://heavyz.blogspot.com/
  - http://buggarden.blogspot.com/

  Created on 2008-11-17.
  $Id: announcement.html 290 2008-12-01 18:28:27Z heavyzheng $
-->
{% endcomment %}

{#------------------------------------------------------------------------------------------------#}

{% block html_head %}

<title>AFCP Announcement</title>
<link rel="stylesheet" type="text/css" media="screen" href="/static/afcp/stylesheets/announcement.css"/>

<script type="text/javascript">//!<[CDATA[

function closeMessage() {
    $(".message").hide("slow");
}

function showAnnouncementEditForm() {
    $(".announcement"           ).hide();
    $(".announcement-submitting").hide();
    $(".announcement-edit-form" ).show("slow");
}

function hideAnnouncementEditForm() {
    $(".announcement-edit-form" ).hide();
    $(".announcement-submitting").hide();
    $(".announcement"           ).show("slow");
}

function submitAnnouncementEditForm() {
    $(".announcement"           ).hide();
    $(".announcement-edit-form" ).hide();
    $(".announcement-submitting").show("slow");
}

//]]></script>

{% endblock %}{# html_head #}

{#------------------------------------------------------------------------------------------------#}

{% block header %}
{% endblock %}{# header #}

{#------------------------------------------------------------------------------------------------#}

{% block content %}

{% if error %}
  <div class="error message">
    {{ error|escape }}
    <a href="javascript:void(0);" onclick="closeMessage();">[close]</a>
  </div>
{% endif %}

{% if info %}
  <div class="info message">
    {{ info|escape }}
    <a href="javascript:void(0);" onclick="closeMessage();">[close]</a>
  </div>
{% endif %}

<div class="announcement">
  <div class="title">
    {{ announcement.title|escape }}
  </div>
  <div class="author-date">
    Posted by {{ announcement.author.nickname }} on {{ announcement.post_date|date:"Y-m-d" }}.
    {% if announcement.update_date %}
      Updated on {{ announcement.update_date|date:"Y-m-d" }}.
    {% endif %}
  </div>
  {% if announcement.has_resume %}
    <div class="resume">
      {{ announcement.resume|escape }}
    </div>
  {% endif %}
  <div class="content">
    {{ announcement.content|escape|linebreaks }}
  </div>
  
  {% if announcement.is_current_user_author or is_admin_ %}
    <div class="edit-toggle">
      <a href="javascript:void(0);" onclick="showAnnouncementEditForm();">[edit]</a>
    </div>
  {% endif %}{# announcement.is_current_user_author or is_admin_ #}
  
</div>

{% if announcement.is_current_user_author or is_admin_ %}

  <form class="announcement-edit-form hidden" action="." method="POST">
    <table width="100%">
      <tr>
        <td class="nowrap" width="1%" align="right">Title:</td>
        <td class="nowrap">
          <input type="text" size="70" name="title" value="{{ announcement.title|escape }}"/>
        </td>
      </tr>
      <tr>
        <td class="nowrap" width="1%" align="right">Resume:</td>
        <td class="nowrap">
          <textarea cols="60" rows="6" name="resume">{{ announcement.resume|default:""|escape }}</textarea>
        </td>
      </tr>
      <tr>
        <td class="nowrap" width="1%" align="right">Content:</td>
        <td class="nowrap">
          <textarea cols="60" rows="12" name="content">{{ announcement.content|escape }}</textarea>
        </td>
      </tr>
      <tr>
        <td></td>
        <td class="nowrap">
          You are logged-in as {{ user_.email }}.
          <br/>
          <input type="submit" value="Update" onclick="submitAnnouncementEditForm();"/>
          <input type="button" value="Cancel" onclick="hideAnnouncementEditForm();"/>
        </td>
      </tr>
    </table>
  </form>
  
  <div class="announcement-submitting hidden">
    <img src="/static/fnr/images/waiting.gif" alt="Submitting"/>
    Submitting... Please wait...
  </div>

{% endif %}{# announcement.is_current_user_author or is_admin_ #}


{% endblock %}{# content #}




